package com.leo.train.business.controller.web;

import com.leo.train.business.entity.DailyTrainInfo;
import com.leo.train.business.service.DailyTrainInfoService;
import com.leo.train.common.resp.CommonResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/daily-train-info")
public class DailyTrainInfoController {
    @Autowired
    private DailyTrainInfoService dailyTrainInfoService;

    @GetMapping("/getTrainStation")
    public CommonResp<List<DailyTrainInfo>> getTrainStation(@RequestParam("trainCode") String trainCode,@DateTimeFormat(pattern = "yyyy-MM-dd") Date date){
        return dailyTrainInfoService.getTrainStation(trainCode, date);
    }
}
